package com.congee02.modelshellmvn.model_controller.train;

/**
 * Yolov8 训练任务
 * <a href="https://docs.ultralytics.com/modes/train/#train-settings">训练设置</a>
 */
public class Yolov8TrainTask {

    /**
     * Specifies the model file for training.
     * Accepts a path to either a .pt pretrained model or a .yaml configuration file.
     * Essential for defining the model structure or initializing weights.
     */
    private String model;

    /**
     * Path to the dataset configuration file (e.g., coco8.yaml).
     * This file contains dataset-specific parameters, including paths to training and validation data, class names, and number of classes.
     */
    private String data;

    /**
     * Total number of training epochs.
     * Each epoch represents a full pass over the entire dataset. Adjusting this value can affect training duration and model performance.
     */
    private Integer epochs;

    /**
     * Maximum training time in hours.
     * If set, this overrides the epochs argument, allowing training to automatically stop after the specified duration.
     * Useful for time-constrained training scenarios.
     */
    private Integer time;

    /**
     * Number of epochs to wait without improvement in validation metrics before early stopping the training.
     * Helps prevent overfitting by stopping training when performance plateaus.
     */
    private Integer patience;

    /**
     * Batch size for training, indicating how many images are processed before the model's internal parameters are updated.
     * AutoBatch (batch=-1) dynamically adjusts the batch size based on GPU memory availability.
     */
    private Integer batch;

    /**
     * Target image size for training.
     * All images are resized to this dimension before being fed into the model.
     * Affects model accuracy and computational complexity.
     */
    private Integer imgsz;

    /**
     * Enables saving of training checkpoints and final model weights. Useful for resuming training or model deployment.
     */
    private Boolean save;

    /**
     * Frequency of saving model checkpoints, specified in epochs.
     * A value of -1 disables this feature.
     * Useful for saving interim models during long training sessions.
     */
    private Integer savePeriod;

    /**
     * Enables caching of dataset images in memory (True/ram), on disk (disk), or disables it (False).
     * Improves training speed by reducing disk I/O at the cost of increased memory usage.
     */
    private Boolean cache;

    /**
     * 	Specifies the computational device(s) for training: a single GPU (device=0), multiple GPUs (device=0,1), CPU (device=cpu), or MPS for Apple silicon (device=mps).
     */
    private String device;

    /**
     * Number of worker threads for data loading (per RANK if Multi-GPU training).
     * Influences the speed of data preprocessing and feeding into the model, especially useful in multi-GPU setups.
     */
    private Integer workers;

    /**
     * Name of the project directory where training outputs are saved. Allows for organized storage of different experiments.
     */
    private String project;

    /**
     * If True, allows overwriting of an existing project/name directory.
     * Useful for iterative experimentation without needing to manually clear previous outputs.
     */
    private Boolean existOk;

    /**
     * Determines whether to start training from a pretrained model.
     * Can be a boolean value or a string path to a specific model from which to load weights.
     * Enhances training efficiency and model performance.
     */
    private Boolean pretrained;

    /**
     * Sets the random seed for training, ensuring reproducibility of results across runs with the same configurations.
     */
    private Long seed;

    /**
     * Name of the training run. Used for creating a subdirectory within the project folder, where training logs and outputs are stored.
     */
    private String name;

    /**
     * Choice of optimizer for training.
     * Options include SGD, Adam, AdamW, NAdam, RAdam, RMSProp etc., or auto for automatic selection based on model configuration.
     * Affects convergence speed and stability.
     */
    private String optimizer;

    /**
     * Enables verbose output during training, providing detailed logs and progress updates. Useful for debugging and closely monitoring the training process.
     */
    private Boolean verbose;

    /**
     * Resumes training from the last saved checkpoint.
     * Automatically loads model weights, optimizer state, and epoch count, continuing training seamlessly.
     */
    private Boolean resume;



}
